package com.ryskoo.customer.vendorbasic.repository;

import com.ryskoo.customer.vendorbasic.domain.VendorBasicPO;
import com.ryskoo.framework.core.repository.BasicJPAImpl;
import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import java.util.List;


@Repository
public class VendorBasicJPAImpl extends BasicJPAImpl<VendorBasicPO> implements IVendorBasicRepository {

	/**
	 * 根据 VendorUuid 查询 vendorBasic
	 * 
	 * @param VendorUuid
	 * @return
	 */
	@Override
	public VendorBasicPO getByVendorUuid(String vendorUuid) {
		String hql = "select o from VendorBasicPO o where o.vendorId = :vendorId";
		Query q = getH4Session().createQuery(hql);
		q.setString("vendorId", vendorUuid);
		List<VendorBasicPO> retList = q.list();
		if (retList != null && retList.size() > 0) {
			return retList.get(0);
		}
		return null;
	}
    
}
